<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtdesigner-plugins.qdoc -->
  <title>Adding Qt Designer Plugins | Qt Creator Manual</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt Creator Manual</a></td><td >Adding Qt Designer Plugins</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="index.html">Qt Creator Manual 4.11.1</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
  <link rel="prev" href="creator-using-qt-designer.html" />
  <link rel="next" href="creator-usability.html" />
<p class="naviNextPrevious headerNavi">
<a class="prevPage" href="creator-using-qt-designer.html">Developing Widget Based Applications</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-usability.html">Optimizing Applications for Mobile Devices</a>
</p><p/>
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#locating-qt-designer-plugins">Locating Qt Designer Plugins</a></li>
<li class="level2"><a href="#configuring-qt-designer-plugins-on-macos">Configuring Qt Designer Plugins on macOS</a></li>
<li class="level1"><a href="#matching-build-keys">Matching Build Keys</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Adding Qt Designer Plugins</h1>
<span class="subtitle"></span>
<!-- $$$adding-plugins.html-description -->
<div class="descr"> <a name="details"></a>
<p>You can use Qt APIs to create plugins that extend Qt applications. This enables you to add your own widgets to Qt Designer. The most flexible way to include a plugin with an application is to compile it into a dynamic library that is shipped separately, and detected and loaded at runtime.</p>
<p>The applications can detect plugins that are stored in the standard plugin subdirectories. For more information on how to create and locate plugins and to change the default plugin path, see <a href="http://doc.qt.io/qt-5/plugins-howto.html">How to Create Qt Plugins</a>.</p>
<p>For more information about how to create plugins for Qt Designer, see <a href="http://doc.qt.io/qt-5/designer-using-custom-widgets.html">Using Custom Widgets with Qt Designer</a>.</p>
<a name="locating-qt-designer-plugins"></a>
<h2 id="locating-qt-designer-plugins">Locating Qt Designer Plugins</h2>
<p>Qt Designer fetches plugins from the standard locations and loads the plugins that match its build key. Qt Designer is delivered both as a standalone application and integrated into Qt Creator. The correct folder to place the plugins depends on whether you use the standalone Qt Designer or the integrated Qt Designer.</p>
<p>The integrated Qt Designer fetches plugins from the <code>\bin\plugins\designer</code> directory in the Qt Creator installation directory on Windows and Linux. For information about how to configure plugins on <a href="nolink">macOS</a>, see <a href="adding-plugins.html#configuring-qt-designer-plugins-on-macos">Configuring Qt Designer Plugins on macOS</a>.</p>
<p>To check which plugins were loaded successfully and which failed, choose <b>Tools</b> &gt; <b>Form Editor</b> &gt; <b>About Qt Designer Plugins</b>.</p>
<p>The standalone Qt Designer is part of the Qt library used for building projects, located in <code>&lt;Qt_version&gt;\&lt;compiler&gt;\bin</code> in the Qt installation directory. It fetches plugins from the <code>\plugins\designer</code> subdirectory of <code>bin</code>. To check which plugins were loaded successfully and which failed, choose <b>Help</b> &gt; <b>About Plugins</b>.</p>
<a name="configuring-qt-designer-plugins-on-macos"></a>
<h3 id="configuring-qt-designer-plugins-on-macos">Configuring Qt Designer Plugins on macOS</h3>
<p>On <a href="nolink">macOS</a>, a GUI application must be built and run from a bundle. A bundle is a directory structure that appears as a single entity when viewed in the Finder. A bundle for an application typcially contains the executable and all the resources it needs.</p>
<p>Qt Creator uses its own set of Qt Libraries located in the bundle, and therefore, you need to configure the Qt Designer plugins that you want to use with Qt Creator. For more information about how to deploy applications to <a href="nolink">macOS</a>, see <a href="http://doc.qt.io/qt-5/macos-deployment.html">Qt for macOS - Deployment</a>.</p>
<p>The following example illustrates how to configure version 5.2&#x2e;1 of the <a href="http://qwt.sourceforge.net/">Qwt - Qt Widgets for Technical Applications</a> library for use with Qt Creator:</p>
<ol class="1" type="1"><li>To check the paths used in the Qwt library, enter the following <code>otool</code> command:<pre class="cpp plain">

  otool -L /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib

</pre>
<p>The output for Qwt 5.2&#x2e;1 indicates that the plugin uses Qt core libraries (<a href="http://doc.qt.io/qt-5/qtdesigner-module.html">QtDesigner</a>, QtScript, <a href="http://doc.qt.io/qt-5/qtxml-module.html">QtXml</a>, <a href="http://doc.qt.io/qt-5/qtgui-module.html">QtGui</a> and <a href="http://doc.qt.io/qt-5/qtcore-module.html">QtCore</a>) and libqwt.5&#x2e;dylib:</p>
<pre class="cpp plain">

  /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib:
          libqwt_designer_plugin.dylib (compatibility version 0.0&#x2e;0, current version 0.0&#x2e;0)
          libqwt.5&#x2e;dylib (compatibility version 5.2&#x2e;0, current version 5.2&#x2e;1)
          QtDesigner.framework/Versions/4/QtDesigner (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          QtScript.framework/Versions/4/QtScript (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          QtXml.framework/Versions/4/QtXml (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          QtGui.framework/Versions/4/QtGui (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          QtCore.framework/Versions/4/QtCore (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          /usr/lib/libstdc++.6&#x2e;dylib (compatibility version 7.0&#x2e;0, current version 7.9&#x2e;0)
          /usr/lib/libgcc_s.1&#x2e;dylib (compatibility version 1.0&#x2e;0, current version 438.0&#x2e;0)
          /usr/lib/libSystem.B&#x2e;dylib (compatibility version 1.0&#x2e;0, current version 125.0&#x2e;1)

</pre>
</li>
<li>You must copy the Qt Designer plugin and the Qwt library files to the following locations:<ul>
<li><code>libqwt_designer_plugin.dylib</code> to <code>Qt Creator.app/Contents/PlugIns/designer</code></li>
<li><code>libqwt.*&#x2e;dylib</code> to <code>Qt Creator.app/Contents/Frameworks</code></li>
</ul>
<p>Enter the following commands:</p>
<pre class="cpp plain">

  sudo cp /Developer/Applications/Qt/plugins/designer/libqwt_designer_plugin.dylib \
          /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
  sudo cp -R /usr/local/qwt-5.2&#x2e;1/lib/*  \
          /Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks/

</pre>
</li>
<li>Enter the following <code>otool</code> command to check the libraries that are used by the Qwt library:<pre class="cpp plain">

  otool -L /usr/local/qwt-5.2&#x2e;1/lib/libqwt.5&#x2e;dylib

</pre>
<p>The command returns the following output:</p>
<pre class="cpp plain">

  /usr/local/qwt-5.2&#x2e;1/lib/libqwt.5&#x2e;dylib:
          libqwt.5&#x2e;dylib (compatibility version 5.2&#x2e;0, current version 5.2&#x2e;1)
          QtGui.framework/Versions/4/QtGui (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          QtCore.framework/Versions/4/QtCore (compatibility version 4.6&#x2e;0, current version 4.6&#x2e;2)
          /usr/lib/libstdc++.6&#x2e;dylib (compatibility version 7.0&#x2e;0, current version 7.9&#x2e;0)
          /usr/lib/libgcc_s.1&#x2e;dylib (compatibility version 1.0&#x2e;0, current version 438.0&#x2e;0)
          /usr/lib/libSystem.B&#x2e;dylib (compatibility version 1.0&#x2e;0, current version 125.0&#x2e;1)

</pre>
</li>
<li>Enter the following <code>install_name_tool</code> command to fix the references of the libraries:<pre class="cpp plain">

  cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/MacOS/designer
  sudo install_name_tool -change
      QtCore.framework/Versions/4/QtCore \
      @executable_path/../Frameworks/libQtCore.4&#x2e;dylib \
      libqwt_designer_plugin.dylib
  sudo install_name_tool -change QtGui.framework/Versions/4/QtGui \
      @executable_path/../Frameworks/libQtGui.4&#x2e;dylib \
      libqwt_designer_plugin.dylib
  sudo install_name_tool -change QtXml.framework/Versions/4/QtXml \
      @executable_path/../Frameworks/libQtXml.4&#x2e;dylib \
      libqwt_designer_plugin.dylib
  sudo install_name_tool -change QtScript.framework/Versions/4/QtScript \
      @executable_path/../Frameworks/libQtScript.4&#x2e;dylib \
      libqwt_designer_plugin.dylib
  sudo install_name_tool -change QtDesigner.framework/Versions/4/QtDesigner \
      @executable_path/../Frameworks/libQtDesigner.4&#x2e;dylib \
      libqwt_designer_plugin.dylib
  sudo install_name_tool -change libqwt.5&#x2e;dylib \
      @executable_path/../Frameworks/libqwt.5&#x2e;dylib \
      libqwt_designer_plugin.dylib

  cd /Developer/Applications/Qt/Qt\ Creator.app/Contents/Frameworks
  sudo install_name_tool -change \
      QtCore.framework/Versions/4/QtCore \
      @executable_path/../Frameworks/libQtCore.4&#x2e;dylib \
      libqwt.5&#x2e;2&#x2e;1&#x2e;dylib
  sudo install_name_tool -change \
      QtGui.framework/Versions/4/QtGui \
      @executable_path/../Frameworks/libQtGui.4&#x2e;dylib \
      libqwt.5&#x2e;2&#x2e;1&#x2e;dylib

</pre>
</li>
</ol>
<a name="matching-build-keys"></a>
<h2 id="matching-build-keys">Matching Build Keys</h2>
<p>The Qt Creator that is included in pre-built Qt packages on Windows is built with the Microsoft Visual Studio compiler, whereas the version of Qt shipped for building applications is configured and built to use the <a href="https://mingw-w64.org/">MinGW</a>/g++ compiler. Plugins built by using this version of Qt cannot be loaded by Qt Creator because the build-keys do not match. The plugins can only be used in the standalone version of Qt Designer. Choose <b>Help &gt; About Qt Creator</b> to check the Qt version Qt Creator was built with.</p>
<p>To use Qt Designer plugins that were built for the shipped Qt version, make sure that Qt Creator is built with the same compiler by either recompiling Qt Creator using <a href="https://mingw-w64.org/">MinGW</a> or recompiling Qt with Microsoft Visual Studio, depending on which configuration you want to use for your applications.</p>
</div>
<!-- @@@adding-plugins.html -->
<p class="naviNextPrevious footerNavi">
<a class="prevPage" href="creator-using-qt-designer.html">Developing Widget Based Applications</a>
<span class="naviSeparator">  &#9702;  </span>
<a class="nextPage" href="creator-usability.html">Optimizing Applications for Mobile Devices</a>
</p>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
